package a.h;

import a.c.q;

import javax.swing.*;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.colorchooser.ColorSelectionModel;
import javax.swing.colorchooser.DefaultColorSelectionModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicColorChooserUI;
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
import java.util.regex.Pattern;

class wd
  extends JColorChooser
{
  static final Object a = "AlphaJColorChooser.PROPERTY_DIALOG_LOCATION";
  static final e_ b = new f_(null);
  private static final Pattern c = Pattern.compile("\\.");
  
  public wd()
  {
    super(new g_());
    a();
  }
  
  private void a()
  {
    int j = ec.t;
    boolean bool = ec.s;
    d_ locald_ = new d_();
    AbstractColorChooserPanel[] arrayOfAbstractColorChooserPanel = getChooserPanels();
    int i = 0;
    do
    {
      if (i >= arrayOfAbstractColorChooserPanel.length) {
        break;
      }
      AbstractColorChooserPanel localAbstractColorChooserPanel = arrayOfAbstractColorChooserPanel[i];
      if (j == 0)
      {
        if ("javax.swing.colorchooser.DefaultRGBChooserPanel".equals(localAbstractColorChooserPanel.getClass().getName()))
        {
          removeChooserPanel(localAbstractColorChooserPanel);
          addChooserPanel(locald_);
        }
        i++;
      }
    } while (!bool);
  }
  
  public wd(Color paramColor)
  {
    super(new g_(paramColor));
    a();
  }
  
  public void setColor(Color paramColor)
  {
    ColorSelectionModel localColorSelectionModel = getSelectionModel();
    if (ec.t == 0)
    {
      if ((localColorSelectionModel instanceof g_)) {
        ((g_)localColorSelectionModel).a(paramColor);
      }
    }
    else if (!ec.s) {
      return;
    }
    super.setColor(paramColor);
  }
  
  public void updateUI()
  {
    int i = ec.t;
    if (i == 0)
    {
      if ("com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(UIManager.getLookAndFeel().getClass().getName()))
      {
        if (i != 0) {
          break label44;
        }
        setUI(BasicColorChooserUI.createUI(this));
      }
    }
    else if (!ec.s) {
      return;
    }
    label44:
    super.updateUI();
  }
  
  public static Color a(Component paramComponent, String paramString, Color paramColor)
    throws HeadlessException
  {
    return a(paramComponent, paramString, paramColor, true);
  }
  
  static Color a(Component paramComponent, String paramString, Color paramColor, boolean paramBoolean)
    throws HeadlessException
  {
    int i = ec.t;
    if (i == 0) {}
    Color localColor = paramColor != null ? paramColor : Color.white;
    JColorChooser localJColorChooser = (i != 0) || ((paramBoolean) && (!c())) ? new wd(localColor) : new JColorChooser(localColor);
    c_ localc_ = new c_(localJColorChooser);
    paramComponent.setLocale(UIManager.getDefaults().getDefaultLocale());
    JDialog localJDialog = createDialog(paramComponent, paramString, true, localJColorChooser, localc_, null);
    localJDialog.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent paramAnonymousWindowEvent)
      {
        Window localWindow = paramAnonymousWindowEvent.getWindow();
        localWindow.hide();
      }
    });
    localJDialog.addComponentListener(new ComponentAdapter()
    {
      public void componentHidden(ComponentEvent paramAnonymousComponentEvent)
      {
        Window localWindow = (Window)paramAnonymousComponentEvent.getComponent();
        localWindow.dispose();
      }
    });
    a(paramComponent).a(paramComponent, localJDialog);
    localJDialog.show();
    return localc_.a();
  }
  
  private static e_ a(Component paramComponent)
  {
    int i = ec.t;
    if ((i != 0) || ((paramComponent instanceof JComponent)))
    {
      Object localObject = ((JComponent)paramComponent).getClientProperty(a);
      if ((i != 0) || ((localObject instanceof e_))) {
        return (e_)localObject;
      }
    }
    return b;
  }
  
  private static boolean c()
  {
    int i = ec.t;
    String str = System.getProperty("java.version");
    if (str == null) {
      return false;
    }
    String[] arrayOfString = c.split(str);
    try
    {
      if (i == 0)
      {
        if (arrayOfString.length <= 1) {
          break label53;
        }
        if (i != 0) {
          break label50;
        }
      }
      label50:
      label53:
      return Integer.parseInt(arrayOfString[1]) >= 7;
    }
    catch (NumberFormatException localNumberFormatException) {}
    return false;
  }
  
  private static final class f_
    implements wd.e_
  {
    private f_() {}
    
    public void a(Component paramComponent, JDialog paramJDialog) {}
    
    f_(wd.0 param0)
    {
      this();
    }
  }
  
  static abstract interface e_
  {
    public abstract void a(Component paramComponent, JDialog paramJDialog);
  }
  
  private static class g_
    extends DefaultColorSelectionModel
  {
    public g_() {}
    
    public g_(Color paramColor)
    {
      super();
    }
    
    public void setSelectedColor(Color paramColor)
    {
      int i = getSelectedColor().getAlpha();
      Color localColor = new Color(paramColor.getRed(), paramColor.getGreen(), paramColor.getBlue(), i);
      super.setSelectedColor(localColor);
    }
    
    void a(int paramInt)
    {
      Color localColor1 = getSelectedColor();
      Color localColor2 = new Color(localColor1.getRed(), localColor1.getGreen(), localColor1.getBlue(), paramInt);
      super.setSelectedColor(localColor2);
    }
    
    void a(Color paramColor)
    {
      super.setSelectedColor(paramColor);
    }
  }
  
  class d_
    extends AbstractColorChooserPanel
    implements ChangeListener
  {
    protected JSlider a;
    protected JSpinner b;
    protected JSlider c;
    protected JSlider e;
    protected JSlider f;
    protected JSpinner g;
    protected JSpinner h;
    protected JSpinner i;
    private final int k = 0;
    private final int l = 255;
    private boolean m = false;
    
    public d_() {}
    
    protected void buildChooser()
    {
      int j = ec.t;
      boolean bool = ec.s;
      String str1 = "Alpha";
      String str2 = UIManager.getString("ColorChooser.rgbRedText");
      String str3 = UIManager.getString("ColorChooser.rgbGreenText");
      String str4 = UIManager.getString("ColorChooser.rgbBlueText");
      Color localColor = wd.this.getSelectionModel().getSelectedColor();
      JLabel localJLabel1 = new JLabel(str2);
      this.c = new JSlider(0, 0, 255, localColor.getRed());
      this.c.setMajorTickSpacing(85);
      this.c.setMinorTickSpacing(17);
      this.c.setPaintTicks(true);
      this.c.setPaintLabels(true);
      localJLabel1.setLabelFor(this.c);
      this.g = new JSpinner(new SpinnerNumberModel(localColor.getRed(), 0, 255, 1));
      JPanel localJPanel1 = new JPanel();
      this.g.addChangeListener(this);
      localJPanel1.add(this.g);
      this.c.addChangeListener(this);
      this.c.putClientProperty("JSlider.isFilled", Boolean.TRUE);
      JLabel localJLabel2 = new JLabel(str3);
      this.e = new JSlider(0, 0, 255, localColor.getGreen());
      this.e.setMajorTickSpacing(85);
      this.e.setMinorTickSpacing(17);
      this.e.setPaintTicks(true);
      this.e.setPaintLabels(true);
      localJLabel2.setLabelFor(this.e);
      this.i = new JSpinner(new SpinnerNumberModel(localColor.getGreen(), 0, 255, 1));
      JPanel localJPanel2 = new JPanel();
      this.i.addChangeListener(this);
      localJPanel2.add(this.i);
      this.e.addChangeListener(this);
      this.e.putClientProperty("JSlider.isFilled", Boolean.TRUE);
      JLabel localJLabel3 = new JLabel(str4);
      this.f = new JSlider(0, 0, 255, localColor.getBlue());
      this.f.setMajorTickSpacing(85);
      this.f.setMinorTickSpacing(17);
      this.f.setPaintTicks(true);
      this.f.setPaintLabels(true);
      localJLabel3.setLabelFor(this.f);
      this.h = new JSpinner(new SpinnerNumberModel(localColor.getBlue(), 0, 255, 1));
      JPanel localJPanel3 = new JPanel();
      this.h.addChangeListener(this);
      localJPanel3.add(this.h);
      this.f.addChangeListener(this);
      this.f.putClientProperty("JSlider.isFilled", Boolean.TRUE);
      JLabel localJLabel4 = new JLabel(str1);
      this.a = new JSlider(0, 0, 255, localColor.getAlpha());
      this.a.setMajorTickSpacing(85);
      this.a.setMinorTickSpacing(17);
      this.a.setPaintTicks(true);
      this.a.setPaintLabels(true);
      this.b = new JSpinner(new SpinnerNumberModel(localColor.getAlpha(), 0, 255, 1));
      localJLabel4.setLabelFor(this.a);
      JPanel localJPanel4 = new JPanel();
      this.b.addChangeListener(this);
      localJPanel4.add(this.b);
      this.a.addChangeListener(this);
      this.a.putClientProperty("JSlider.isFilled", Boolean.TRUE);
      setLayout(new BorderLayout());
      GridBagLayout localGridBagLayout = new GridBagLayout();
      setLayout(localGridBagLayout);
      GridBagConstraints localGridBagConstraints = new GridBagConstraints();
      localGridBagConstraints.gridx = 0;
      localGridBagConstraints.gridy = 0;
      localGridBagConstraints.anchor = 21;
      add(localJLabel1, localGridBagConstraints);
      localGridBagConstraints.gridx = 1;
      localGridBagConstraints.anchor = 10;
      add(this.c, localGridBagConstraints);
      localGridBagConstraints.gridx = 2;
      add(localJPanel1, localGridBagConstraints);
      localGridBagConstraints.gridx = 0;
      localGridBagConstraints.gridy = 1;
      localGridBagConstraints.anchor = 21;
      add(localJLabel2, localGridBagConstraints);
      localGridBagConstraints.gridx = 1;
      localGridBagConstraints.anchor = 10;
      add(this.e, localGridBagConstraints);
      localGridBagConstraints.gridx = 2;
      add(localJPanel2, localGridBagConstraints);
      localGridBagConstraints.gridx = 0;
      localGridBagConstraints.gridy = 2;
      localGridBagConstraints.anchor = 21;
      add(localJLabel3, localGridBagConstraints);
      localGridBagConstraints.gridx = 1;
      localGridBagConstraints.anchor = 10;
      add(this.f, localGridBagConstraints);
      localGridBagConstraints.gridx = 2;
      add(localJPanel3, localGridBagConstraints);
      localGridBagConstraints.gridx = 0;
      localGridBagConstraints.gridy = 3;
      localGridBagConstraints.anchor = 21;
      add(localJLabel4, localGridBagConstraints);
      localGridBagConstraints.gridx = 1;
      localGridBagConstraints.anchor = 10;
      add(this.a, localGridBagConstraints);
      localGridBagConstraints.gridx = 2;
      add(localJPanel4, localGridBagConstraints);
      if ((j != 0) || (bool))
      {
        if (j == 0) {}
        q.n = !q.n;
      }
      if (j != 0) {
        q.o = !q.o;
      }
    }
    
    public void updateChooser()
    {
      if (ec.t == 0)
      {
        if (!this.m)
        {
          this.m = true;
          a(getColorFromModel());
        }
      }
      else {
        this.m = false;
      }
    }
    
    public String getDisplayName()
    {
      return "RGBA";
    }
    
    public Icon getLargeDisplayIcon()
    {
      return null;
    }
    
    public Icon getSmallDisplayIcon()
    {
      return null;
    }
    
    public int getMnemonic()
    {
      int j = ec.t;
      Object localObject = UIManager.get("ColorChooser.rgbMnemonic");
      if (j == 0) {
        if ((localObject instanceof Integer)) {
          return ((Integer)localObject).intValue();
        }
      }
      if (j == 0) {
        if ((localObject instanceof String)) {
          try
          {
            return Integer.parseInt((String)localObject);
          }
          catch (NumberFormatException localNumberFormatException) {}
        }
      }
      return -1;
    }
    
    public int getDisplayedMnemonicIndex()
    {
      int j = ec.t;
      Object localObject = UIManager.get("ColorChooser.rgbDisplayedMnemonicIndex");
      if (j == 0) {
        if ((localObject instanceof Integer)) {
          return ((Integer)localObject).intValue();
        }
      }
      if (j == 0) {
        if ((localObject instanceof String)) {
          try
          {
            return Integer.parseInt((String)localObject);
          }
          catch (NumberFormatException localNumberFormatException) {}
        }
      }
      return -1;
    }
    
    public void stateChanged(ChangeEvent paramChangeEvent)
    {
      int i3 = ec.t;
      int j;
      int n;
      int i1;
      int i2;
      if (i3 == 0) {
        if ((paramChangeEvent.getSource() instanceof JSlider))
        {
          if (i3 != 0) {
            break label110;
          }
          if (!this.m)
          {
            j = this.a.getValue();
            n = this.c.getValue();
            i1 = this.e.getValue();
            i2 = this.f.getValue();
            ((wd.g_)wd.this.getSelectionModel()).a(new Color(n, i1, i2, j));
            if ((i3 == 0) && (!ec.s)) {
              return;
            }
          }
        }
      }
      label110:
      if (((i3 != 0) || ((paramChangeEvent.getSource() instanceof JSpinner))) && ((i3 != 0) || (!this.m)))
      {
        j = ((Integer)this.b.getValue()).intValue();
        n = ((Integer)this.g.getValue()).intValue();
        i1 = ((Integer)this.i.getValue()).intValue();
        i2 = ((Integer)this.h.getValue()).intValue();
        ((wd.g_)wd.this.getSelectionModel()).a(new Color(n, i1, i2, j));
      }
    }
    
    private void a(Color paramColor)
    {
      int i3 = ec.t;
      int j = paramColor.getRed();
      int n = paramColor.getBlue();
      int i1 = paramColor.getGreen();
      int i2 = paramColor.getAlpha();
      if (i3 == 0) {
        if (this.c.getValue() != j) {
          this.c.setValue(j);
        }
      }
      if (i3 == 0) {
        if (this.e.getValue() != i1) {
          this.e.setValue(i1);
        }
      }
      if (i3 == 0) {
        if (this.f.getValue() != n) {
          this.f.setValue(n);
        }
      }
      if (i3 == 0) {
        if (this.a.getValue() != i2) {
          this.a.setValue(i2);
        }
      }
      if (i3 == 0) {
        if (((Integer)this.g.getValue()).intValue() != j) {
          this.g.setValue(new Integer(j));
        }
      }
      if (i3 == 0) {
        if (((Integer)this.i.getValue()).intValue() != i1) {
          this.i.setValue(new Integer(i1));
        }
      }
      if (i3 == 0) {
        if (((Integer)this.h.getValue()).intValue() != n) {
          this.h.setValue(new Integer(n));
        }
      }
      if ((i3 != 0) || (((Integer)this.b.getValue()).intValue() != i2)) {
        this.b.setValue(new Integer(i2));
      }
    }
  }
  
  private static class c_
    implements ActionListener, Serializable
  {
    JColorChooser a;
    Color c;
    
    c_(JColorChooser paramJColorChooser)
    {
      this.a = paramJColorChooser;
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      this.c = this.a.getColor();
    }
    
    public Color a()
    {
      return this.c;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.h.wd

 * JD-Core Version:    0.7.0.1

 */